package com.own.component.common.login.function;

import javax.servlet.http.HttpServletRequest;

/**
 * LoginInfoFunction
 *
 * @author chenxueli
 * @date 2023-08-08 16:57:00
 */
public class LoginInfoFunction {

    private final HttpServletRequest request;
    private final String key;

    public LoginInfoFunction(HttpServletRequest request, String key) {
        this.request = request;
        this.key = key;
    }

    /**
     * 设置信息
     *
     * @param content 信息内容
     */
    public final void set(String content) {
        request.setAttribute(key, content);
    }

    /**
     * 获取信息
     *
     * @return 信息内容
     */
    public final String get() {
        return (String) request.getAttribute(key);
    }

}
